<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>欢迎登录</title>
    <link rel="stylesheet" href="../public/css/bootstrap.css">
    <style>
        .wraper{
            margin: 140px auto;
            width: 50%;
        }
        .wraper h1{
            text-align: center;
            font-weight: bold;
            color: rgb(0, 0, 0);
            text-shadow: 10px 5px 10px silver;
        }
        .wraper > div{
            border: 1px solid #f0f0f0;
            border-radius: 10px;
            padding: 15px 20px 0 15px;
            box-shadow: 0 0 10px rgb(230, 230, 230);
        }
        .wraper p{
            border-radius: 5px;
            border: 1px solid #f0f0f0;
            padding: 10px 20px;
            margin-top: 20px;
            box-shadow: 0 0 10px rgb(230, 230, 230);
        }
    </style>
</head>
<body>
    <div class="wraper">
        <h1>欢迎注册</h1>
        <div class="form">
            <form>
                <div class="form-group">
                    <label for="nickname" class="">昵称</label>
                    <div class="">
                        <input type="text" class="form-control" id="nickname"
                        placeholder="Nickname" name="nickname" maxlength="5">
                    </div>
                </div>
                <div class="form-group">
                    <label for="email" class="">邮箱</label>
                    <div class="">
                        <input type="text" class="form-control" id="email"
                        placeholder="Email" name="email">
                    </div>
                </div>
                <div class="form-group">
                    <label for="password" class="">密码</label>
                    <div class="">
                        <input type="password" class="form-control" id="password"
                        placeholder="PassWord" name="password">
                    </div>
                </div>
                <div class="form-group">
                    <div class="">
                        <input type="submit" class="btn btn-success form-control" id="register" value="注 册">
                    </div>
                </div>
            </form>
        </div>
        <p>
            已有账号！<a href="/login">点击登录</a>
        </p>
    </div>
</body>
<script src="../public/js/jquery-1.10.2.min.js"></script>
<script>
    $('#register').on('submit',function(e){
        e.preventDefault();
        let fromData = $(this).serialize();
        console.log(fromData);
        $.ajax({
            url: '/register',
            type: 'post',
            data: fromData,
            dataType: 'json',
            success: data => {
                console.log(data)
            }
        })
    })
</script>
</html>